module.exports = function (grunt) {
    // 项目配置
    grunt.initConfig({
        clean: {
            dist: ['Public/Js/App/app.min.js', 'Public/Js/App/app.js']
        },
        concat: {
            css: {
                src: ['Public/Css/Home/**/*.css'],
                dest: 'Public/Css/App/app.css'
            },
            appjs: {
                src: [
                    'Public/Js/Home/Index/IndexModule.js',
                    'Public/Js/Home/Index/IndexController.js',
                    'Public/Js/Home/Index/IndexDirective.js'
                ],
                dest: 'Public/Js/App/app.js'
            }
        },
        cssmin: {
            css: {
                src: 'Public/Css/App/app.css',
                dest: 'Public/Css/App/app.min.css'
            }
        },
        uglify: {
            app: {
                options: {
                    report: "min",
                    mangle: false  //不混淆变量名
                },
                files: [{
                    expand: true,
                    cwd: 'Public/Js/App', //js目录下
                    src: '*.js', //所有js文件
                    dest: 'Public/Js/App', //输出到此目录下
                    ext: '.min.js' //添加后缀
                }]
            }
        }
    });

    // 加载提供"uglify"任务的插件
    grunt.loadNpmTasks('grunt-contrib-uglify');
    // 加载提供"cssmin"任务的插件
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    // 加载提供"concat"任务的插件
    grunt.loadNpmTasks('grunt-contrib-concat');
    // 加载提供"clean"任务的插件
    grunt.loadNpmTasks('grunt-contrib-clean');

    // 默认任务
    grunt.registerTask('default', ['clean', 'concat', 'cssmin', 'uglify']);
};
